// 批量处理告警事件请求
const axios = require('axios');
const fs = require('fs').promises;

async function sendPostRequest(url, data) {
    try {
        const response = await axios.post(url, data, {
            headers: {
                'Content-Type': 'application/json',
                'User-Agent': 'BatchPostScript/1.0',
                cookie: 'csrftoken=ZussU97s1DemWraaSH3kbWGkRnZa9Xbk; sessionid=133f67f5dbfb2e08c7d37083f1260982',
                "x-csrftoken":"ZussU97s1DemWraaSH3kbWGkRnZa9Xbk"
            },
            timeout: 30000
        });
        
        return {
            statusCode: response.status,
            response: response.data,
            success: response.status === 200 || response.status === 201
        };
    } catch (error) {
        return {
            statusCode: error.response?.status || null,
            response: error.message,
            success: false
        };
    }
}

async function batchPostRequests(url, dataList, concurrency = 5, delay = 100) {
    const results = [];
    
    // 分批处理以控制并发
    for (let i = 0; i < dataList.length; i += concurrency) {
        const batch = dataList.slice(i, i + concurrency);
        
        const promises = batch.map(async (data, index) => {
            const globalIndex = i + index;
            const result = await sendPostRequest(url, data);
            result.index = globalIndex;
            result.originalData = data;
            
            console.log(`请求 ${globalIndex + 1}/${dataList.length} 完成 - 状态: ${result.success ? '成功' : '失败'}`);
            
            return result;
        });
        
        const batchResults = await Promise.all(promises);
        results.push(...batchResults);
        
        // 批次间延迟
        if (i + concurrency < dataList.length && delay > 0) {
            await new Promise(resolve => setTimeout(resolve, delay));
        }
    }
    
    return results;
}

async function main() {
    const url = 'http://10.67.2.179:19399/internal_isop_incident-20250615-0/_doc';
    
    // 示例数据
    const sampleDataList = [
        {
        "kill_chain_stage": 4,
        "event_type_path": "/事件类型/网络攻击/漏洞攻击/远程代码命令执行",
        "analysis_technology": "SIMPLE",
        "code": 200,
        "occur_count": 1,
        "destination": [
            {
                "country": "美国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "136.5.22.170",
                "groups": [],
                "uri": "/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "ip_location": "39.765053,-101.40791",
                "url": "http://crmwww.crm.bmcc.com.cn/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "http",
                "port": 80,
                "district": "",
                "domain": "crmwww.crm.bmcc.com.cn",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "mail_sender": "",
        "alertlevel": 5,
        "source": [
            {
                "country": "德国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "美因河畔法兰克福",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "黑森州",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "18.193.187.245",
                "groups": [],
                "uri": "",
                "ip_location": "50.11081,8.687473",
                "url": "",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "",
                "port": 2752,
                "district": "",
                "domain": "",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "q_body": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "attack_dir": 0,
        "log_ts": [
            1749541909000
        ],
        "result": 0,
        "update_time": 0,
        "event_type": "网络劫持",
        "operation_event_type": 1,
        "payload": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "cost_time": 0,
        "case_id": 0,
        "op_operator": "",
        "action": "0",
        "dispose_result": 4,
        "id": "25ef2441c50abd2b2fb37d310523fd6d",
        "direction": 0,
        "timestamp": 1749714721300,
        "log_id": [
            "964612bf34e33180_1749541909000"
        ],
        "event_rule_id": 9437192,
        "event_suggestion_id": 0,
        "is_key_event": 0,
        "end_time": 1749541909000,
        "priority_level": 3,
        "reliability_level": 1,
        "attck_tag": "{\"version\":\"V3.0R02F02SP01\",\"content\":{\"cep_mode\":0,\"tag_class\":0,\"attck_list\":[[{\"technique\":\"T1589.001\",\"log_ids\":[\"964612bf34e33180_1749541909000\"],\"tactic\":\"TA0043\"}]]}}",
        "threat_dir": 0,
        "attack_character": [
            [
                {
                    "log_id": "964612bf34e33180_1749541909000",
                    "feature": [
                        {
                            "match_start": -1,
                            "character": "63966\\\"\" />",
                            "transform": [],
                            "description": "",
                            "match_field": "q_body",
                            "match_end": -1
                        }
                    ]
                }
            ]
        ],
        "suggestion_detail": "",
        "x_forwarded_for": "10.67.5.1,10.67.5.2,10.67.5.3,10.67.5.4",
        "op_state": 0,
        "start_time": "1751011500120",
        "disposal_suggestion": 1,
        "cve_id": [],
        "data_auth_id": [
            0
        ],
        "event_name": "测试事件{{$string.uuid}}",
        "device": [
            {
                "product_type": "UTS",
                "module": "",
                "hash_device": "3C8C-577F-278E-09F9",
                "dev_ip": "10.67.2.97"
            }
        ],
        "disposal_type": 0,
        "op_object": [],
        "r_body": "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/5.0\r\nDate: Tue, 16 Aug 2005 08:01:43 GMT\r\nContent-Language: ch\r\nCache-Control: private\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Length: 91\r\n\r\n<command name=\"ChangeToolTip\" control=\"Initiate Phone\" value=\"呼叫到 \\\"13520163966\\\"\" />"
        },
        {
        "kill_chain_stage": 4,
        "event_type_path": "/事件类型/网络攻击/漏洞攻击/远程代码命令执行",
        "analysis_technology": "SIMPLE",
        "code": 200,
        "occur_count": 1,
        "destination": [
            {
                "country": "美国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "136.5.22.170",
                "groups": [],
                "uri": "/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "ip_location": "39.765053,-101.40791",
                "url": "http://crmwww.crm.bmcc.com.cn/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "http",
                "port": 80,
                "district": "",
                "domain": "crmwww.crm.bmcc.com.cn",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "mail_sender": "",
        "alertlevel": 5,
        "source": [
            {
                "country": "德国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "美因河畔法兰克福",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "黑森州",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "18.193.187.245",
                "groups": [],
                "uri": "",
                "ip_location": "50.11081,8.687473",
                "url": "",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "",
                "port": 2752,
                "district": "",
                "domain": "",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "q_body": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "attack_dir": 0,
        "log_ts": [
            1749541909000
        ],
        "result": 0,
        "update_time": 0,
        "event_type": "网络劫持",
        "operation_event_type": 1,
        "payload": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "cost_time": 0,
        "case_id": 0,
        "op_operator": "",
        "action": "0",
        "dispose_result": 4,
        "id": "25ef2441c50abd2b2fb37d310523fd6d",
        "direction": 0,
        "timestamp": 1749714721300,
        "log_id": [
            "964612bf34e33180_1749541909000"
        ],
        "event_rule_id": 9437192,
        "event_suggestion_id": 0,
        "is_key_event": 0,
        "end_time": 1749541909000,
        "priority_level": 3,
        "reliability_level": 1,
        "attck_tag": "{\"version\":\"V3.0R02F02SP01\",\"content\":{\"cep_mode\":0,\"tag_class\":0,\"attck_list\":[[{\"technique\":\"T1589.001\",\"log_ids\":[\"964612bf34e33180_1749541909000\"],\"tactic\":\"TA0043\"}]]}}",
        "threat_dir": 0,
        "attack_character": [
            [
                {
                    "log_id": "964612bf34e33180_1749541909000",
                    "feature": [
                        {
                            "match_start": -1,
                            "character": "63966\\\"\" />",
                            "transform": [],
                            "description": "",
                            "match_field": "q_body",
                            "match_end": -1
                        }
                    ]
                }
            ]
        ],
        "suggestion_detail": "",
        "x_forwarded_for": "10.67.5.1,10.67.5.2,10.67.5.3,10.67.5.4",
        "op_state": 0,
        "start_time": "1751011500120",
        "disposal_suggestion": 1,
        "cve_id": [],
        "data_auth_id": [
            0
        ],
        "event_name": "测试事件{{$string.uuid}}",
        "device": [
            {
                "product_type": "UTS",
                "module": "",
                "hash_device": "3C8C-577F-278E-09F9",
                "dev_ip": "10.67.2.97"
            }
        ],
        "disposal_type": 0,
        "op_object": [],
        "r_body": "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/5.0\r\nDate: Tue, 16 Aug 2005 08:01:43 GMT\r\nContent-Language: ch\r\nCache-Control: private\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Length: 91\r\n\r\n<command name=\"ChangeToolTip\" control=\"Initiate Phone\" value=\"呼叫到 \\\"13520163966\\\"\" />"
        },
        {
        "kill_chain_stage": 4,
        "event_type_path": "/事件类型/网络攻击/漏洞攻击/远程代码命令执行",
        "analysis_technology": "SIMPLE",
        "code": 200,
        "occur_count": 1,
        "destination": [
            {
                "country": "美国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "136.5.22.170",
                "groups": [],
                "uri": "/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "ip_location": "39.765053,-101.40791",
                "url": "http://crmwww.crm.bmcc.com.cn/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "http",
                "port": 80,
                "district": "",
                "domain": "crmwww.crm.bmcc.com.cn",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "mail_sender": "",
        "alertlevel": 5,
        "source": [
            {
                "country": "德国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "美因河畔法兰克福",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "黑森州",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "18.193.187.245",
                "groups": [],
                "uri": "",
                "ip_location": "50.11081,8.687473",
                "url": "",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "",
                "port": 2752,
                "district": "",
                "domain": "",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "q_body": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "attack_dir": 0,
        "log_ts": [
            1749541909000
        ],
        "result": 0,
        "update_time": 0,
        "event_type": "网络劫持",
        "operation_event_type": 1,
        "payload": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "cost_time": 0,
        "case_id": 0,
        "op_operator": "",
        "action": "0",
        "dispose_result": 4,
        "id": "25ef2441c50abd2b2fb37d310523fd6d",
        "direction": 0,
        "timestamp": 1749714721300,
        "log_id": [
            "964612bf34e33180_1749541909000"
        ],
        "event_rule_id": 9437192,
        "event_suggestion_id": 0,
        "is_key_event": 0,
        "end_time": 1749541909000,
        "priority_level": 3,
        "reliability_level": 1,
        "attck_tag": "{\"version\":\"V3.0R02F02SP01\",\"content\":{\"cep_mode\":0,\"tag_class\":0,\"attck_list\":[[{\"technique\":\"T1589.001\",\"log_ids\":[\"964612bf34e33180_1749541909000\"],\"tactic\":\"TA0043\"}]]}}",
        "threat_dir": 0,
        "attack_character": [
            [
                {
                    "log_id": "964612bf34e33180_1749541909000",
                    "feature": [
                        {
                            "match_start": -1,
                            "character": "63966\\\"\" />",
                            "transform": [],
                            "description": "",
                            "match_field": "q_body",
                            "match_end": -1
                        }
                    ]
                }
            ]
        ],
        "suggestion_detail": "",
        "x_forwarded_for": "10.67.5.1,10.67.5.2,10.67.5.3,10.67.5.4",
        "op_state": 0,
        "start_time": "1751011500120",
        "disposal_suggestion": 1,
        "cve_id": [],
        "data_auth_id": [
            0
        ],
        "event_name": "测试事件{{$string.uuid}}",
        "device": [
            {
                "product_type": "UTS",
                "module": "",
                "hash_device": "3C8C-577F-278E-09F9",
                "dev_ip": "10.67.2.97"
            }
        ],
        "disposal_type": 0,
        "op_object": [],
        "r_body": "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/5.0\r\nDate: Tue, 16 Aug 2005 08:01:43 GMT\r\nContent-Language: ch\r\nCache-Control: private\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Length: 91\r\n\r\n<command name=\"ChangeToolTip\" control=\"Initiate Phone\" value=\"呼叫到 \\\"13520163966\\\"\" />"
        },
        {
        "kill_chain_stage": 4,
        "event_type_path": "/事件类型/网络攻击/漏洞攻击/远程代码命令执行",
        "analysis_technology": "SIMPLE",
        "code": 200,
        "occur_count": 1,
        "destination": [
            {
                "country": "美国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "136.5.22.170",
                "groups": [],
                "uri": "/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "ip_location": "39.765053,-101.40791",
                "url": "http://crmwww.crm.bmcc.com.cn/ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Init",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "http",
                "port": 80,
                "district": "",
                "domain": "crmwww.crm.bmcc.com.cn",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "mail_sender": "",
        "alertlevel": 5,
        "source": [
            {
                "country": "德国",
                "referer": "",
                "sample_file_sha256": "",
                "city": "美因河畔法兰克福",
                "user_name": "",
                "asset_id": "",
                "mac": "",
                "ti_hit_fields": "",
                "password": "",
                "application_protocol": "",
                "asset_name": "",
                "province": "黑森州",
                "sample_file_md5": "",
                "asset_type": "",
                "file_name": "",
                "ip": "18.193.187.245",
                "groups": [],
                "uri": "",
                "ip_location": "50.11081,8.687473",
                "url": "",
                "asset_admin": "",
                "sample_file_sha1": "",
                "protocol_type": "",
                "port": 2752,
                "district": "",
                "domain": "",
                "sample_file_name": "",
                "host_name": ""
            }
        ],
        "q_body": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "attack_dir": 0,
        "log_ts": [
            1749541909000
        ],
        "result": 0,
        "update_time": 0,
        "event_type": "网络劫持",
        "operation_event_type": 1,
        "payload": "GET /ecommunications_chs/start.swe?SWEMethod=GetDynamicTooltip&SWECmd=InvokeMethod&SWEService=Communications+Client&ControlName=Initiate+Phone&Work+Edit=13520163966&Work+Edit_HasFocus=true&FocusBusComp=Service+Request HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: Keep-Alive\r\nCookie: SWEUAID=none; _sn=WLRGuPGjKDDAht1VT4nL4a0sygLOYbq9tKaJ6MHDt5c_\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nHost: crmwww.crm.bmcc.com.cn\r\nCache-Control: no-cache\r\n\r\n",
        "cost_time": 0,
        "case_id": 0,
        "op_operator": "",
        "action": "0",
        "dispose_result": 4,
        "id": "25ef2441c50abd2b2fb37d310523fd6d",
        "direction": 0,
        "timestamp": 1749714721300,
        "log_id": [
            "964612bf34e33180_1749541909000"
        ],
        "event_rule_id": 9437192,
        "event_suggestion_id": 0,
        "is_key_event": 0,
        "end_time": 1749541909000,
        "priority_level": 3,
        "reliability_level": 1,
        "attck_tag": "{\"version\":\"V3.0R02F02SP01\",\"content\":{\"cep_mode\":0,\"tag_class\":0,\"attck_list\":[[{\"technique\":\"T1589.001\",\"log_ids\":[\"964612bf34e33180_1749541909000\"],\"tactic\":\"TA0043\"}]]}}",
        "threat_dir": 0,
        "attack_character": [
            [
                {
                    "log_id": "964612bf34e33180_1749541909000",
                    "feature": [
                        {
                            "match_start": -1,
                            "character": "63966\\\"\" />",
                            "transform": [],
                            "description": "",
                            "match_field": "q_body",
                            "match_end": -1
                        }
                    ]
                }
            ]
        ],
        "suggestion_detail": "",
        "x_forwarded_for": "10.67.5.1,10.67.5.2,10.67.5.3,10.67.5.4",
        "op_state": 0,
        "start_time": "1751011500120",
        "disposal_suggestion": 1,
        "cve_id": [],
        "data_auth_id": [
            0
        ],
        "event_name": "测试事件{{$string.uuid}}",
        "device": [
            {
                "product_type": "UTS",
                "module": "",
                "hash_device": "3C8C-577F-278E-09F9",
                "dev_ip": "10.67.2.97"
            }
        ],
        "disposal_type": 0,
        "op_object": [],
        "r_body": "HTTP/1.1 200 OK\r\nServer: Microsoft-IIS/5.0\r\nDate: Tue, 16 Aug 2005 08:01:43 GMT\r\nContent-Language: ch\r\nCache-Control: private\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Length: 91\r\n\r\n<command name=\"ChangeToolTip\" control=\"Initiate Phone\" value=\"呼叫到 \\\"13520163966\\\"\" />"
        },

    ];
    
    console.log(`开始批量发送 ${sampleDataList.length} 个POST请求...`);
    
    try {
        const results = await batchPostRequests(url, sampleDataList, 5, 100);
        
        const successCount = results.filter(r => r.success).length;
        const failedCount = results.length - successCount;
        
        console.log('\n批量请求完成！');
        console.log(`成功: ${successCount}`);
        console.log(`失败: ${failedCount}`);
        
        // 保存结果
        await fs.writeFile('batch_results.json', JSON.stringify(results, null, 2));
        console.log('详细结果已保存到 batch_results.json');
        
        // 显示失败的请求
        if (failedCount > 0) {
            console.log('\n失败的请求:');
            results.filter(r => !r.success).forEach(result => {
                console.log(`索引 ${result.index}: ${result.response}`);
            });
        }
    } catch (error) {
        console.error('执行过程中出现错误:', error);
    }
}

if (require.main === module) {
    main();
}